package com.pactera.madp.cp.controller.sidebar.roomqt;

import com.pactera.madp.common.log.annotation.SysLog;
import com.pactera.madp.common.security.annotation.Inner;
import com.pactera.madp.cp.api.entity.CorpEntity;
import com.pactera.madp.cp.service.ICorpService;
import com.pactera.madp.cp.service.RuleTouchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(value = "qttouchrule", tags = "群聊质检定时任务")
@RequestMapping("/qttouchrule")
public class SyncqtController {

    @Autowired
    private RuleTouchService ruleTouchService;
    @Autowired
    private ICorpService corpService;

    @SysLog("质检规则定时任务")
    @GetMapping("/checkregularly")
    @ApiOperation("/质检规则定时任务")
    @Inner
    public void checkRegularly() {
        List<CorpEntity> list = corpService.list();
        list.forEach(f -> {
            ruleTouchService.checkRegularly(f.getCorpId());
        });
    }

}
